from Queue import Queue
from heapq import heappush, heappop

class PriorityQueue(Queue):
    #http://code.activestate.com/recipes/87369/
    # Initialize the queue representation
    def _init(self, maxsize):
        self.maxsize = maxsize
        self.queue = []

    # Put a new item in the queue
    def _put(self, item):
        return heappush(self.queue, item)

    # Get an item from the queue
    def _get(self):
        p, item = heappop(self.queue)
	return item

    def put_normal(self, item):
	self.put((100, item))

    def put_fast(self, item):
	self.put((50, item))

    def put_high(self, item):
	self.put((0, item))
